package br.ufrgs.inf.engsoft.stp.user;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@SuppressWarnings("serial")
@Entity
@Table(name = "stp_role")
public class Role implements Serializable {
    
    public static final String ROLE_ADMIN = "Gerente";
    public static final String ROLE_CLIENT = "Cliente";
	
	@Id
	@Column(name = "name", unique = true, nullable = false)
	private String name;
	
	@OneToMany(mappedBy = "role")
    @Cascade({CascadeType.ALL})
    private List<User> users; 
	
	public Role() {
	}
 
	public Role(String name) {
		this.name = name;
	}
 
	public String getName() {
		return this.name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public List<User> getUsers() {
        return this.users;
    }
	
    public void setUsers(List<User> users) {
        this.users = users;
    }
}